package com.inspur.dgov.common.secure.exception;

import com.inspur.dgov.common.tool.api.IResultCode;
import com.inspur.dgov.common.tool.api.ResultCode;
import lombok.Getter;

/**
 * Secure异常
 *
 * @Author chiyupei
 * @Date 19/7/2 下午7:40
 * @Version 1.0
 * @Description Secure异常
 */
public class SecureException extends RuntimeException {

    private static final long serialVersionUID = 2359767895161832954L;

    @Getter
    private final IResultCode resultCode;

    public SecureException(String message) {
        super(message);
        this.resultCode = ResultCode.UN_AUTHORIZED;
    }

    public SecureException(IResultCode resultCode) {
        super(resultCode.getMessage());
        this.resultCode = resultCode;
    }

    public SecureException(IResultCode resultCode, Throwable cause) {
        super(cause);
        this.resultCode = resultCode;
    }

    @Override
    public Throwable fillInStackTrace() {
        return this;
    }
}
